"use strict";

export const genIntRandom = (min, max) => (Math.random() * (parseInt(max) - parseInt(min) + 1) | 0) + parseInt(min);

function genFloatRandomBetween(min, max) {
    return Math.random() * (parseFloat(max) - parseFloat(min)) + parseFloat(min);
}

function demoLogic() {
    console.log("\nsetDemoLogic");
    for(var i=0; i<10; i+=1) {
        //let rNum = RandomDemo.genFloatRandomBetween(1,1.2);
        let rNum = genIntRandom(0,100);
        console.log("整形随机数[0,100], index = "+i+", rNum = "+rNum);
    }

    for(var i=0; i<10; i+=1) {
        //let rNum = RandomDemo.genFloatRandomBetween(1,1.2);
        let rNum = genFloatRandomBetween(2.0, 2.5);
        console.log("浮点随机数[2.0, 2.5], index = "+i+", rNum = "+rNum);
    }
}

export {demoLogic, genFloatRandomBetween};